<template>
    <div>
        <a-card v-for="ac in activityData" title="活动" style="margin-top: 13px">
            <!--            <a-tag slot="extra" color="#f50" v-if="ac.isDefault===true">默认地址</a-tag>-->
            <template slot="actions" class="ant-card-actions">
                <a-button key="set-default" type="link" style="color: red;font-weight: 600;font-size: 20px"
                          @click="toSchedule(ac)">报名
                </a-button>
            </template>
            <a-row>
                <div style="font-size: 24px;color: black;font-weight: 500;text-align: center">
                    {{ac.name}}
                </div>
            </a-row>
            <a-row class="ac-row">
                <a-col :span="3">
                    开始时间:
                </a-col>
                <a-col :span="21">
                    {{moment(ac.startTime).format("YYYY-MM-DD")}}
                </a-col>
            </a-row>
            <a-row class="ac-row">
                <a-col :span="3">
                    结束时间:
                </a-col>
                <a-col :span="21">
                    {{moment(ac.endTime).format("YYYY-MM-DD")}}
                </a-col>
            </a-row>

        </a-card>

    </div>
</template>

<script>
    import activityApi from "../../../api/remarketing/activityApi";
    import moment from 'moment-timezone'

    export default {
        name: "activity",
        data() {
            return {
                activityData: []
            }
        },
        created() {
            this.loadData()
        },
        methods: {
            moment,
            loadData() {
                activityApi.processingList().then(resp => {
                    if (resp.data.flag) {
                        this.activityData = resp.data.data
                    }
                })
            },
            toSchedule(ac) {
                if (ac && ac.url) {
                    this.$router.push(ac.url)
                } else {
                    this.$router.push("/cell-center/schedule?id=" + ac.id)
                }
            }
        }

    }
</script>

<style scoped>

</style>